/**
 * 版权所有 2009-2012山东新北洋信息技术股份有限公司
 * 保留所有权利。
 */
package com.linyaonan.leetcode.easy._10_02;

/**
 * @ProjectName: leetcode
 * @Package: com.linyaonan.leetcode.easy._10_02
 * @ClassName: NumWays
 * @Author: linyaonan
 * @Date: 2020/4/3 15:30
 */
public class NumWays {
    public int numWays(int n) {
        if (n <= 1) {
            return 1;
        }
        int[] ints = new int[n];
        ints[0] = 1;
        ints[1] = 2;
        for (int i = 2; i < ints.length; i++) {
            ints[i] = (ints[i-1] + ints[i-2]) % 1000000007;
        }
        return ints[n - 1];
    }
}
